#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define ADD(a, b)	((a) + (b))
#define SUB(a, b)	((a) - (b))
#define MUL(a, b)	((a) * (b))
#define DIV(a, b)	((a) / (b))

int main(int argc, char **argv)
{
	int res, left, right;

	if (argc < 4) {
		printf("命令行参数的个数不足以四则运算\n");
		return 1;
	}

	left = atoi(argv[1]);
	right = atoi(argv[3]);

	if (strcmp(argv[2], "+") == 0) {
		res = ADD(left, right);
	} else if (strcmp(argv[2], "-") == 0) {
		res = SUB(left, right);
	} else if (strcmp(argv[2], "x") == 0) {
		res = MUL(left, right);
	} else if (strcmp(argv[2], "/") == 0) {
		res = DIV(left, right);
	} else {
		printf("不支持\n");
		return 1;
	}

	printf("%d %s %d = %d\n", left, argv[2], right, res);

	return 0;
}

